package com.example.shopp_2301.room

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query

/**
 * room数据库三元素之一：dao  对表进行增删改查等操作  根据实际情况添加   只有查询需要返回值  一般为集合
 */
@Dao
interface HistoryDao {

    //新增
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(historyEntity: HistoryEntity)

    //删除
    @Delete
    fun delete(historyEntity: HistoryEntity)

    @Query("select * from history where phone = :phone")
    fun query(phone:String):MutableList<HistoryEntity>
}